﻿using DLog.Config;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace DLog.Access
{
    public sealed class DalFactory
    {
        /// <summary>
        /// Get the interactive interface operation log
        /// </summary>
        /// <param name="DalAssemblyStr"></param>
        /// <param name="connectionString"></param>
        /// <returns></returns>
        public static IDal GetDal(string target, string connectionString)
        {
            string DalClassNameStr = StorageConfig.GetClassName(target);
            object[] ob = new object[] { connectionString };
            Assembly asm = Assembly.GetExecutingAssembly();
            return (IDal)asm.CreateInstance(DalClassNameStr, false, System.Reflection.BindingFlags.Default, null, ob, null, null);
            //return new NotepadDal(connectionString);
        }
    }
}
